<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<form class="layui-form layui-form-pane">
	<input type="hidden" name="lineId" value="${busLine.lineId }">
	<div class="layui-form-item">
		<label class="layui-form-label">线路名称</label>
		<div class="layui-input-inline">
			<input type="text" name="lineName" autocomplete="off"
				lay-verType="tips" lay-verify="required" class="layui-input"
				value="${busLine.lineName}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">起始站点</label>
		<div class="layui-input-inline">
			<input type="text" name="startStation" autocomplete="off"
				lay-verType="tips" lay-verify="required" class="layui-input"
				value="${busLine.startStation}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">终到站点</label>
		<div class="layui-input-inline">
			<input type="text" name="endStation" autocomplete="off"
				lay-verType="tips" lay-verify="required" class="layui-input"
				value="${busLine.endStation}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">票价</label>
		<div class="layui-input-inline">
			<input type="text" name="ticketPrice" autocomplete="off"
				lay-verType="tips" lay-verify="required" class="layui-input"
				value="${busLine.ticketPrice}">
		</div>
	</div>
	<div class="layui-form-item">
		<div style="margin-left: 20px;">
			<button class="layui-btn" type="button" id="upd">修改</button>
		</div>
	</div>
</form>
<script type="text/javascript">
	$("#upd").click(function() {
		$.ajax({
			type : "POST",
			url : "busLine/upd",
			data : $("form").serialize(),
			async : true,
			dataType : "json",
			success : function(res) {
				let
				msg = "线路修改成功！"
				if (res.code === 0) {
					msg = "线路修改失败！"
				} else if (res.code === -1) {
					msg = "线路已经存在，不能修改！"
				} else if (res.code === -2) {
					msg = "内容没有变化，无需修改！"
				} else if (res.code === -3) {
					msg = "数据验证失败！"
				}
				layer.open({
					content : msg,
				});
				if (res.code === 1) {
					loadPage("busLine/showAll")
				}
			}
		});
	})
</script>